*******Pew Research Center Poll: PEW RESEARCH CENTER JANUARY 2020 POLITICAL SURVEY
use "Pew Priority/Pew Data/Pew_2020_Jan.dta", clear


*Year
gen year=2020

*CC Priority
gen CCpriority1=q60pf2

recode CCpriority1 ///
		(1=4 "Top priority") ///
		(2=3 "Important but lower priority") ///
		(3=2 "Not too important") ///
		(4=1 "Should not be done") ///
		(else=.), ///
		gen(CCpriority)
lab var CCpriority "Climate Change Priority"
drop CCpriority1

*Party Preference
recode partysum ///
	(1 = 1 "GOP") ///
	(9 = 2 "Independent") ///
	(2=3 "Democrat") ///
	(else=.), ///
	gen(partyid)
lab var partyid "Party Preference"

*Gender
recode sex ///
	(1=0 "Male") ///
	(2=1 "Female") ///
	(else=.), ///
	gen(female)
lab var female "Female"	

*Age
gen AGE=age
replace age=. if age==99
replace age=89 if age>=89 
lab var age "Age"

*Cohort
gen age_cohort = year-AGE
replace age_cohort=. if AGE== 98|AGE ==99
recode age_cohort ///
	(1900/1904=1 "1900-1904") ///
	(1905/1909=2 "1905-1909") ///
	(1910/1914=3 "1910-1914") ///
	(1915/1919=4 "1915-1919") ///
	(1920/1924=5 "1920-1924") ///
	(1925/1929=6 "1925-1929") ///
	(1930/1934=7 "1930-1934") ///
	(1935/1939=8 "1935-1939") ///
	(1940/1944=9 "1940-1944") ///
	(1945/1949=10 "1945-1949") ///
	(1950/1954=11 "1950-1954") ///
	(1955/1959=12 "1955-1959") ///
	(1960/1964=13 "1960-1964") ///
	(1965/1969=14 "1965-1969") ///
	(1970/1974=15 "1970-1974") ///
	(1975/1979=16 "1975-1979") ///
	(1980/1984=17 "1980-1984") ///
	(1985/1989=18 "1985-1989") ///
	(1990/1994=19 "1990-1994") ///
	(1995/1999=20 "1995-1999") ///
	(2000/2004=21 "2000-2004"), ///
	gen(cohort)
la var cohort "Age Cohort, 5 yr. intervals"

*Education
recode educ ///
	(1 2=1 "<HS") ///
	(3 4=2 "HS Graduate") ///
	(5=3 "Some College") ///
	(6 7 8=4 "College Graduate") ///
	(else=.), ///
	gen(education)
lab var education "Education"

*Racial Identity
recode racethn ///
	(1=1 "White") ///
	(2=2 "Black") ///
	(3=3 "Hispanic") ///
	(4=4 "Other") ///
	(else=.), ///
	gen(race)
lab var race "Racial Identity"

*Rural Inhabitance
/*NA IN 2020
gen DENSITY=density
recode DENSITY ///
	(1=5 "Lowest density") ///
	(2=4) ///
	(3=3 "Middle density") ///
	(4=2) ///
	(5=1 "Highest density") ///
	(else=.), ///
	gen(density1)
drop density DENSITY
rename density1 density
lab var density "Population Density"
*/

encode usr, gen(rural1)
recode rural1 ///
	(2 3=0 "Sub/Urban") ///
	(1=1 "Rural") ///
	(else=.), ///
	gen(rural)
lab var rural "Rural Inhabitance"
drop rural1
	
*Southern State
recode cregion ///
	(1 2 4 = 0 "not South") ///
	(3=1 "South") ///
	(else=.), ///
	gen(south)
lab var south "Southern State"


/*
*weight
gen weight=weight
*/

*ID
gen id=respid+20200000

*Keep and save
keep CCpriority partyid female age ///
	education race rural south ///
	year weight id cohort
save "Pew Priority/Individual Recoded Pew Files/Pew_2020_Jan_Recode", replace
